package com.jihu.design.behavioral.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jihu
 * @date 2021/9/29
 */
public class MMTikToker extends AbstractTikToker {

    List<AbstractFans> fansList = new ArrayList<>();

    void startSell(){
        System.out.println("......开始卖课.....源码设计课");
        notifyFans("开始卖课了，源码设计课，只要666");
    }

    void endSell(){
        System.out.println(".....结束卖课.....源码设计课");
        notifyFans("课已经卖完了，记得五星好评...");
    }

    @Override
    void addFans(AbstractFans fans) {
        fansList.add(fans);
    }

    @Override
    void notifyFans(String msg) {
        for (AbstractFans fans : fansList) {
            fans.acceptMsg(msg);
        }
    }
}
